<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<html>
<head>
    <title>编辑问卷</title>
    <style>
        .container { width: 600px; margin: 50px auto; }
        .form-group { margin-bottom: 15px; }
        .form-group label { display: block; margin-bottom: 5px; }
        .form-group input, .form-group textarea, .form-group select { 
            width: 100%; 
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .btn { 
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .btn-cancel {
            background-color: #9e9e9e;
            text-decoration: none;
            display: inline-block;
            margin-left: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>编辑问卷</h2>
        <form action="${pageContext.request.contextPath}/survey/update/${survey.id}" method="post">
            <div class="form-group">
                <label>标题：</label>
                <input type="text" name="title" value="${survey.title}" required>
            </div>
            <div class="form-group">
                <label>描述：</label>
                <textarea name="description" rows="4">${survey.description}</textarea>
            </div>
            <div class="form-group">
                <label>状态：</label>
                <select name="status">
                    <option value="0" ${survey.status == 0 ? 'selected' : ''}>草稿</option>
                    <option value="1" ${survey.status == 1 ? 'selected' : ''}>发布</option>
                    <option value="2" ${survey.status == 2 ? 'selected' : ''}>结束</option>
                </select>
            </div>
            <button type="submit" class="btn">保存</button>
            <a href="${pageContext.request.contextPath}/survey/list" class="btn btn-cancel">取消</a>
        </form>
    </div>
</body>
</html>
